<?php
include_once("../module/micro_shop/includes/plugin_micro_shop_class.php");

$microShop = new MicroShop();

//保存
if($_POST['act']=='upgrade' && $_POST['member_id']>0){
    $payInfo = array(
        'admin_name'=>"{$_SESSION['ADMIN_USER']}",
        'payment_name'=>"SELF",
        'text'=>"人工操作",
        'behavior'=>"店铺升级到".($_POST['level']==1?"首席馆":"红人馆")
    );
    $type = 1;  //后台人工操作。不发红包
    $status = $microShop->upgrade_shop($_POST['member_id'], $_POST['level'],null,$payInfo,$type);

    if($status){
        $sql = "update ".TARENTO." set can_upgrade_shop=0 where member_id={$_POST['member_id']}";
        $db->query($sql);//升级后，则去掉升级权利
        die(json_encode(array('code'=>0,'msg'=>'success')));
    }else{
        die(json_encode(array('code'=>-1,'msg'=>'用户未开店或店铺已升级过')));
    }
}

$tpl->assign('memberId',$_GET['id']);
$tpl->display('shop_upgrade.htm');